package com.zy.openchat.core.model.group;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.List;

public class GroupManagePermissionInfo implements Parcelable {
    //禁止私聊
    public boolean banWhisper;

    //禁止发送网页链接
    public boolean banSendWebLink;
    //禁止发送二维码
    public boolean banSendQRcode;
    //禁止发送关键字
    public boolean banSendKeyword;

    public boolean kickWhoSendKeyword;
    public boolean showKickMessage;
    public long chatId;

    public List<String> keywords;


    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeByte(this.banWhisper ? (byte) 1 : (byte) 0);
        dest.writeByte(this.banSendWebLink ? (byte) 1 : (byte) 0);
        dest.writeByte(this.banSendQRcode ? (byte) 1 : (byte) 0);
        dest.writeByte(this.banSendKeyword ? (byte) 1 : (byte) 0);
        dest.writeByte(this.kickWhoSendKeyword ? (byte) 1 : (byte) 0);
        dest.writeByte(this.showKickMessage ? (byte) 1 : (byte) 0);
        dest.writeLong(this.chatId);
        dest.writeStringList(this.keywords);
    }

    public void readFromParcel(Parcel source) {
        this.banWhisper = source.readByte() != 0;
        this.banSendWebLink = source.readByte() != 0;
        this.banSendQRcode = source.readByte() != 0;
        this.banSendKeyword = source.readByte() != 0;
        this.chatId = source.readLong();
        this.keywords = source.createStringArrayList();
        this.kickWhoSendKeyword = source.readByte() != 0;
        this.showKickMessage = source.readByte() != 0;
    }

    public GroupManagePermissionInfo() {
    }

    protected GroupManagePermissionInfo(Parcel in) {
        this.banWhisper = in.readByte() != 0;
        this.banSendWebLink = in.readByte() != 0;
        this.banSendQRcode = in.readByte() != 0;
        this.banSendKeyword = in.readByte() != 0;
        this.chatId = in.readLong();
        this.keywords = in.createStringArrayList();
        this.kickWhoSendKeyword = in.readByte() != 0;
        this.showKickMessage = in.readByte() != 0;
    }

    public static final Creator<GroupManagePermissionInfo> CREATOR = new Creator<GroupManagePermissionInfo>() {
        @Override
        public GroupManagePermissionInfo createFromParcel(Parcel source) {
            return new GroupManagePermissionInfo(source);
        }

        @Override
        public GroupManagePermissionInfo[] newArray(int size) {
            return new GroupManagePermissionInfo[size];
        }
    };
}
